﻿'
' Copyright (c) 2010-2012, MatthiWare
'
' Permission is hereby granted, free of charge, to any person obtaining a
' copy of this software and associated documentation files (the "Software"),
' to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense,
' and/or sell copies of the Software, and to permit persons to whom the
' Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in
' all copies or substantial portions of the Software. 
' You shall include 'MatthiWare' in the credits/about section of the program
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
'

Imports SharpDX.Direct2D1
Imports System.IO
Imports TerrariaVB.Core.Base
Imports TerrariaVB.Core.Helper

Public Class Tile



    Public Shared TileSize As Int32 = 16
    Public Shared TileSetSpacing As Int32 = 2
    Public Shared TileRandomness As UInt32 = 3

    Public Shared Character As Bitmap
    Public Shared Sky As Bitmap
    Public Shared Background As Bitmap
    Public Shared DirtTileSet As Bitmap

    Public Shared DirtID As Int32 = 0
    Public Shared GrassID As Int32 = 1
    Public Shared AirID As Int32 = 2
    Public Shared StoneID As Int32 = 3
    Public Shared CopperID As Int32 = 4
    Public Shared IronID As Int32 = 5
    Public Shared SilverID As Int32 = 6
    Public Shared GoldID As Int32 = 6

    Public Shared Dirt As New BlockInfo(DirtID, 0, "Dirt", 0)
    Public Shared Grass As New BlockInfo(GrassID, 0, "Grass", 0)
    Public Shared Air As New BlockInfo(AirID, 0, "Air", 0)
    Public Shared Stone As New BlockInfo(StoneID, 0, "Stone", 0)
    Public Shared Copper As New BlockInfo(CopperID, 0, "Copper Ore", 0)
    Public Shared Iron As New BlockInfo(IronID, 0, "Iron Ore", 0)
    Public Shared Silver As New BlockInfo(CopperID, 0, "Silver Ore", 0)
    Public Shared Gold As New BlockInfo(GoldID, 0, "Gold Ore", 0)

    Public Shared InvBack As Bitmap

    Public Shared Sub LoadImage(ByVal e As GameCoreEventArgs)
        Dim logLoader As String = String.Empty

            ' Setting local variables
            Dim svcContent As Zip = e.Core.Services.GetService(GetType(Zip))
            Dim target As RenderTarget = e.Core.RenderTarget2D

            'Laden
        InvBack = BitmapHelper.LoadFromStream(target, svcContent.Extract("Img\InvBack.png"), Color.White)
            ' Old InvBack = Bitmap.FromFile(".\Content\Img\InvBack.png", True)

        Character = BitmapHelper.LoadFromStream(target, svcContent.Extract("Img\NPC_22.png"), Color.White)
            ' old Character = Bitmap.FromFile(".\Content\Img\NPC_22.png", True)

        Background = BitmapHelper.LoadFromStream(target, svcContent.Extract("Img\Background_2.png"))
            ' oldBackground = Bitmap.FromFile(".\Content\Img\Background_2.png", True)

        Sky = BitmapHelper.LoadFromStream(target, svcContent.Extract("Img\Background.png"))
            ' oldSky = Bitmap.FromFile(".\Content\Img\Background.png", True)

        DirtTileSet = BitmapHelper.LoadFromStream(target, svcContent.Extract("Img\Tiles\TileSet.png"), Color.Fuchsia)
            ' oldDirtTileSet = Bitmap.FromFile(".\Content\Img\Tiles\TileSet.png", True)

    End Sub

End Class
